package com.itheima.view.views;

import javax.swing.*;

public class Favorite extends JPanel {
    //创建复写框
    //复选框类继承JPanel
    JCheckBox sport, computer, music, read;

    public Favorite() {
        sport = new JCheckBox("运动");
        computer = new JCheckBox("电脑");
        music = new JCheckBox("音乐");
        read = new JCheckBox("读书");
        add(new JLabel("爱好"));
        add(sport);
        add(computer);
        add(music);
        add(read);
        sport.setSelected(false);//未选中
        computer.setSelected(false);
        music.setSelected(false);
        read.setSelected(false);
    }
}